create a snap of the cli (#1108)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 13 May 2023 13:42:31 +0000 (07:42 -0600)
committerGitHub <noreply@github.com>
Sat, 13 May 2023 13:42:31 +0000 (07:42 -0600)
* try to build a snap on github.

* save artifact

* add test and continuous release

* permissions

* try to get sha into snap

* try harder to get sha in

* use pre-existing source

* debug missing sha

* force version into snap instead of sha

* shorten version

* make version more sortable

* avoid dying on info display

* pipes vs ors

* more work on sha

* again sha...

.github/workflows/ubuntu.yml
snap/snapcraft.yaml [new file with mode: 0755]

index ab17eefeb3f7be9cb723196995f72f09d0e21573..247cb9c807326a67dc78a86b7d38044a12b0a44b 100644 (file)
@@ -78,3 +78,42 @@ jobs:
         CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
       run: |
         ./tools/travis_script_linux_coverage
+
+  snap:
+    name: snap Build
+    runs-on: ubuntu-latest
+    outputs:
+      snap-file: ${{ steps.build-snap.outputs.snap }}
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v3
+
+    - name: Build
+      uses: snapcore/action-build@v1
+      id: build-snap
+
+    # Make sure the snap is installable
+    - name: Test
+      run: |
+        sudo snap install --devmode --dangerous ${{ steps.build-snap.outputs.snap }}
+        export GBTEMP=$(pwd)/gbtemp
+        mkdir -p "$GBTEMP"
+        /snap/bin/gpsbabel -D3 || true
+        ./testo -p /snap/bin/gpsbabel 
+
+    - name: Deploy
+      # This only handles continous releases now, for other events artifacts may be saved in
+      # the 'Upload Artifacts' step.
+      if: ( github.event_name == 'push' ) && ( github.ref == 'refs/heads/master' )
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        RELEASE_NAME: Continuous-Linux
+      run: |
+        ./tools/uploadtool/upload_github.sh ${{ steps.build-snap.outputs.snap }}
+
+    - name: Upload Artifacts
+      uses: actions/upload-artifact@v3
+      with:
+        name: ${{ steps.build-snap.outputs.snap }}
+        path: ${{ steps.build-snap.outputs.snap }}
+        retention-days: 7
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
new file mode 100755 (executable)
index 0000000..1db316d
--- /dev/null
@@ -0,0 +1,74 @@
+name: gpsbabel # you probably want to 'snapcraft register <name>'
+base: core22 # the base snap is the execution environment for this snap
+version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
+summary: "Convert, manipulate and transfer GPS data"
+description: |
+  Convert, manipulate and transfer data from GPS programs or GPS
+  recievers.  Open source and supported on macOS, Windows and Linux.
+
+license: GPL-2.0
+title: GPSBabel
+source-code: https://github.com/GPSBabel/gpsbabel.git
+website: https://www.gpsbabel.org
+
+grade: devel # must be 'stable' to release into candidate/stable channels
+confinement: devmode # use 'strict' once you have the right plugs and slots
+
+apps:
+  gpsbabel:
+    command: /usr/bin/gpsbabel
+
+adopt-info: gpsbabel
+parts:
+  gpsbabel:
+    # See 'snapcraft plugins'
+    plugin: cmake
+    cmake-parameters:
+      - -DCMAKE_BUILD_TYPE=Release
+      - -DGPSBABEL_WITH_ZLIB=pkgconfig
+      - -DGPSBABEL_WITH_SHAPELIB=pkgconfig
+    cmake-generator: Ninja
+    source: .
+    override-pull: |
+      craftctl default
+      # add install command to CMakeLists.txt
+      echo "install(TARGETS gpsbabel CONFIGURATIONS Release RUNTIME DESTINATION /usr/bin)" >> CMakeLists.txt
+      # jam repo sha into GITHUB_SHA
+      sed -i -e"/GB.SHA/i set(ENV{GITHUB_SHA} \"$(git log -1 --format=%h)\")" gbversion.cmake
+      # set snap version
+      # ensure version has at most 32 characters
+      craftctl set version=$(git log -1 --format='LinuxInstaller-%h-%ad' --date=format:%Y%m%d)
+
+    build-packages:
+      - git
+      - vim
+      - g++
+      - ninja-build
+      - zlib1g-dev
+      - libshp-dev
+      - libusb-1.0-0-dev
+      - pkg-config
+      - libudev-dev
+      - qt6-base-dev
+      - libqt6core5compat6-dev
+      - libqt6opengl6-dev
+      - libqt6serialport6-dev
+      - libqt6webenginecore6-bin
+      - libgl-dev
+      - libopengl-dev
+      - libvulkan-dev
+      - libx11-xcb-dev
+      - libxkbcommon-dev
+      - qt6-l10n-tools
+      - qt6-tools-dev
+      - qt6-tools-dev-tools
+      - qt6-translations-l10n
+      - qt6-webengine-dev
+      - qt6-webengine-dev-tools
+      - qt6-wayland
+    stage-packages:
+      - zlib1g
+      - libshp2
+      - libusb-1.0-0
+      - libqt6core6
+      - libqt6core5compat6